// $codepro.audit.disable largeNumberOfParameters
/**Appointment Presenter **/
package edu.gatech.presenters;

import javax.swing.JOptionPane;

import edu.gatech.userclasses.Patient;
import edu.gatech.utilities.Persistence;
/**Presenter that creates an appointment
 * 
 * @author Tyler Natoli
 * @version 1.0
 */
public class AppointmentPresenter {
	
	/**Patient that is creating an appointment**/
	private final Patient currentPatient;
	
	/**
	 * Appoint presenter getting the patient from the GUI
	 * @param currentPatient
	 */
	public AppointmentPresenter(Patient currentPatient){
		this.currentPatient = currentPatient;
	}
	
	/**Creates an appointment
	 * 
	 * @param reason
	 * @param time
	 * @param day
	 * @param month
	 * @param desiredDoc
	 * @param emergency
	 */
	public void createAppointment(String reason, String time, String day, String month, 
			String desiredDoc, boolean emergency){ // $codepro.audit.disable largeNumberOfParameters
		if(emergency){
			reason = "EMERGENCY - " + reason; // $codepro.audit.disable questionableAssignment
		}
		final String date = month + " " + day;
		currentPatient.makeAppointment(reason, time, date, desiredDoc);
		currentPatient.getInfo().setPendingAppointment(true);
		Persistence.save();
		JOptionPane.showMessageDialog(null, "Your appointment has been created");
	}
	
	/**
	 * Overrides toString
	 * @return String
	 */
	public String toString(){
		return "Appointment Presenter";
	}
}
